import { createApp } from "vue";
// 引入element-ui
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
// 富文本

import { QuillEditor } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.snow.css";

import App from "./App.vue";
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
// 引入css样式
import "./assets/css/publice.css";
// 引入进度条的样式
import "nprogress/nprogress.css";

// 引入路由
import router from "./router/router";
app
    .use(ElementPlus)
    .use(router)
    .component("QuillEditor", QuillEditor)
    .mount("#app");
// 引入组件面包屑
import mbx from "./components/mbx.vue";
app.component("mbx", mbx);
router.beforeEach((to, from, next) => {
    if (to.path != "/login") {
        if (!sessionStorage.getItem("token")) {
            alert("请先登录哦");
            next("/login");
        }
    }
    next();
});